package com.wisnews.pojo;

import java.io.Serializable;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import lombok.Data;

@Data
public class Input<T> implements Serializable {

	private static final long serialVersionUID = -680643749313115968L;
	/**
	 * @Fields page : 第几页
	 */
	private int page = 1;
	/**
	 * @Fields limit : 分页数量
	 */
	private int limit = 10;
	private T req;

	public <O> IPage<O> toPage() {
		return new Page<>(getPage(), getLimit());
	}

	public int offset() {
		return page > 0 ? (page - 1) * limit : 0;
	}

	public int size() {
		return limit;
	}
}
